package com.chzc.fm.duotin.ui.home.utils;

import android.util.Log;

import com.chzc.fm.duotin.utils.DuotinTask;
import com.chzc.fm.duotin.utils.HttpUtil;
import com.chzc.fm.duotin.utils.LogUtil;

/**
 * Created by Administrator on 2016/6/24.
 */
public class HomeUtils {
    public static final String bannerUrl ="http://api.duotin.com/homepage/index?platform=android&source=&longitude=&package=com.duotin.fm&user_key=&version=2.7.17&latitude=&device_token=ApAGKmVYxulVx07dqhwXL525y0ZMx9A68VRw7Tu_c7tk&channel=baidu&device_key=000000000000000";
    //栏目需要拼接的字符串
    public static String PLAYER1_JUMP_URL ="http://api.duotin.com/content?device_key=864394107420848&platform=android&source=&device_token=Alh9lJLZ-OzgErDIlP1k7mUPaym19e7wq-cs_RXcplxW&user_key=ce2aea08904c06e5e6d435b210a8c939&package=com.duotin.fm&longitude=119.23576999999999&latitude=26.08729166666667&channel=duotin&version=2.7.17&content_id=";
    //专题需要添加的界面
    public static String TOPIC_URL = "http://api.duotin.com/album?source=&longitude=&device_key=000000000000000&platform=android&package=com.duotin.fm&user_key=&sort_type=0&version=2.7.17&page_size=100&latitude=&device_token=AtgTNuvw2Y3ct8rEogirZvAtfCzdjW871cbIy9ZMY3uW&page=1&channel=duotin&album_id=";
    //播放1页面跳转后的界面
    public static String PLAY1_PALYLIST = "http://api.duotin.com/album/page?page_size=100&platform=android&user_key=ce2aea08904c06e5e6d435b210a8c939&package=com.duotin.fm&version=2.7.17&album_id=0&device_key=864394107420848&source=&device_token=Alh9lJLZ-OzgErDIlP1k7mUPaym19e7wq-cs_RXcplxW&sort_type=0&longitude=119.23576999999999&latitude=26.08729166666667&channel=duotin&content_id=";
    public static void getRecommend(DuotinTask.IRequestCallback callback) {

        final DuotinTask.IRequest request = new DuotinTask.IRequest() {
            @Override
            public Object doRequest() {return HttpUtil.doGet(bannerUrl);
            }
        };


        new DuotinTask(request,callback).execute();

    }

    public static void getPlayerMessage(DuotinTask.IRequestCallback callback, final String id) {

        final DuotinTask.IRequest request = new DuotinTask.IRequest() {
            @Override
            public Object doRequest() {
                LogUtil.e("Player1ActivityurlUrl"+PLAYER1_JUMP_URL+id);
                return HttpUtil.doGet(PLAYER1_JUMP_URL+id);
            }
        };


        new DuotinTask(request,callback).execute();

    }

    //获取下载页面的数据
    public static void getDownLoadList(DuotinTask.IRequestCallback callback, final String id){
        DuotinTask.IRequest request = new DuotinTask.IRequest() {
            @Override
            public Object doRequest() {

                Log.e("id"," = "+TOPIC_URL+id);
                return HttpUtil.doGet(TOPIC_URL+id);
            }
        };
        new DuotinTask(request,callback).execute();


    }
    //获取专题页面跳转后的播放列表界面
    public static void getTopicContent(DuotinTask.IRequestCallback callback, final String id){
        DuotinTask.IRequest request = new DuotinTask.IRequest() {
            @Override
            public Object doRequest() {

                return HttpUtil.doGet(TOPIC_URL+id);
            }
        };
        new DuotinTask(request,callback).execute();
    }
    //获取播放一点击右上角按钮跳转后的播放列表界面
    public static void getPlay1PlayList(DuotinTask.IRequestCallback callback, final String id){
        DuotinTask.IRequest request = new DuotinTask.IRequest() {
            @Override
            public Object doRequest() {

                LogUtil.e("dataListHttp - "+PLAY1_PALYLIST+id);
                return HttpUtil.doGet(PLAY1_PALYLIST+id);
            }
        };
        new DuotinTask(request,callback).execute();
    }
}
